/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #1a1a1a;
  font-family: Arial, sans-serif;
  color: #fff;
}

/* 游戏包装器 */
.game-wrapper {
  max-width: 1000px;
  width: 100%;
  padding: 20px;
}

/* 游戏头部 */
.game-header {
  text-align: center;
  margin-bottom: 20px;
}

.game-header h1 {
  color: #00f7ff;
  text-shadow: 0 0 10px rgba(0, 247, 255, 0.5);
  margin-bottom: 15px;
}

.game-info {
  display: flex;
  justify-content: space-between;
  background: rgba(0, 247, 255, 0.1);
  padding: 10px 20px;
  border-radius: 5px;
  border: 1px solid rgba(0, 247, 255, 0.3);
  margin-bottom: 10px;
}

/* 特殊效果容器 */
.effects-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.effect-item {
  background: rgba(0, 0, 0, 0.5);
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: bold;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

/* 游戏容器 */
.game-container {
  background: radial-gradient(circle at 50% 20%, #0a0a2e, #000);
  border: 2px solid #00f7ff;
  box-shadow: 0 0 30px rgba(0, 247, 255, 0.3);
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  position: relative;
}

/* 障碍物样式 */
.obstacle {
  position: absolute;
  background: linear-gradient(135deg, #d4b483, #8b6b43);
  border: 1px solid #a89060;
  box-shadow: 0 0 10px rgba(212, 180, 131, 0.5);
  border-radius: 4px;
  animation: obstacleGlow 2s infinite alternate;
}

@keyframes obstacleGlow {
  from {
      box-shadow: 0 0 10px rgba(212, 180, 131, 0.5);
  }
  to {
      box-shadow: 0 0 15px rgba(212, 180, 131, 0.8);
  }
}

/* 画布样式 */
#gameCanvas {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #00f7ff;
  display: block;
  margin: 0 auto;
}

/* 游戏控制 */
.game-controls {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button-group {
  display: flex;
  gap: 10px;
}

/* 速度控制滑块 */
#speedControl {
  width: 150px;
  accent-color: #00f7ff;
  background: rgba(0, 247, 255, 0.1);
  border-radius: 5px;
}

/* 难度选择下拉菜单 */
.difficulty-select {
  padding: 5px 10px;
  background: rgba(0, 247, 255, 0.1);
  border: 1px solid rgba(0, 247, 255, 0.3);
  border-radius: 5px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  outline: none;
}

.difficulty-select option {
  background: #0a0a2e;
  color: #fff;
}

/* 按钮样式 */
button {
  padding: 8px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.primary-btn {
  background: #00f7ff;
  color: #000;
}

.secondary-btn {
  background: rgba(0, 247, 255, 0.2);
  color: #00f7ff;
  border: 1px solid #00f7ff;
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(0, 247, 255, 0.5);
}

button:active {
  transform: scale(0.95);
}

/* 游戏说明 */
.game-footer {
  background: rgba(0, 247, 255, 0.1);
  border-radius: 10px;
  padding: 20px;
  border: 1px solid rgba(0, 247, 255, 0.3);
}

.game-instructions h2 {
  color: #00f7ff;
  margin-bottom: 15px;
  text-align: center;
}

.instructions-content {
  display: flex;
  justify-content: space-around;
  gap: 20px;
}

.control-instructions, .game-rules, .food-types {
  flex: 1;
}

.instructions-content h3 {
  color: #00f7ff;
  margin-bottom: 10px;
}

.instructions-content ul {
  list-style: none;
}

.instructions-content li {
  margin: 5px 0;
  padding-left: 20px;
  position: relative;
}

.instructions-content li::before {
  content: "•";
  color: #00f7ff;
  position: absolute;
  left: 0;
}

/* 食物图标 */
.food-icon {
  display: inline-block;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.food-icon.normal {
  background: #ff0066;
  box-shadow: 0 0 5px #ff0066;
}

.food-icon.speedBoost {
  background: #00ff88;
  box-shadow: 0 0 5px #00ff88;
}

.food-icon.doubleScore {
  background: #ffff00;
  box-shadow: 0 0 5px #ffff00;
}

.food-icon.shield {
  background: #00f7ff;
  box-shadow: 0 0 5px #00f7ff;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .game-wrapper {
      padding: 10px;
  }
  
  .game-info {
      flex-direction: column;
      gap: 10px;
  }
  
  .instructions-content {
      flex-direction: column;
  }
  
  .game-controls {
      flex-direction: column;
      gap: 15px;
  }
  
  .button-group {
      width: 100%;
      justify-content: center;
  }
}

/* AI分数和长度显示 */
.ai-score, .ai-length {
  color: #ff3366;
  text-shadow: 0 0 5px rgba(255, 51, 102, 0.5);
  font-weight: bold;
  margin-top: 5px;
}

/* AI规则样式 */
.ai-rules {
  margin-top: 20px;
  padding: 15px;
  background: rgba(255, 51, 102, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(255, 51, 102, 0.3);
}

.ai-rules h3 {
  color: #ff3366;
  margin-bottom: 10px;
}

.ai-rules ul {
  list-style-type: none;
  padding-left: 0;
}

.ai-rules li {
  margin: 5px 0;
  color: #ff3366;
  font-size: 0.9em;
}

/* 游戏规则容器 */
.game-rules {
  margin-top: 20px;
  padding: 20px;
  background: rgba(0, 247, 255, 0.1);
  border-radius: 10px;
  border: 1px solid rgba(0, 247, 255, 0.3);
}

.game-rules h3 {
  color: #00f7ff;
  margin-bottom: 10px;
}

.game-rules ul {
  list-style-type: none;
  padding-left: 0;
}

.game-rules li {
  margin: 5px 0;
  color: #00f7ff;
  font-size: 0.9em;
}

/* 控制按钮样式 */
.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background: #00f7ff;
  color: #000;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

button:hover {
  background: #00ff88;
  transform: translateY(-2px);
}

button.secondary-btn {
  background: #ff3366;
  color: #fff;
}

button.secondary-btn:hover {
  background: #ff0066;
}

/* 速度控制样式 */
#speedControl {
  width: 150px;
  height: 5px;
  -webkit-appearance: none;
  background: #00f7ff;
  border-radius: 5px;
  outline: none;
}

#speedControl::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  background: #00ff88;
  border-radius: 50%;
  cursor: pointer;
}

/* 难度选择样式 */
#difficultySelect {
  padding: 8px;
  border: 1px solid #00f7ff;
  border-radius: 4px;
  background: transparent;
  color: #00f7ff;
  cursor: pointer;
  font-size: 14px;
  outline: none;
}

#difficultySelect option {
  background: #000;
  color: #00f7ff;
}

/* 响应式布局 */
@media (max-width: 800px) {
  .game-container {
      padding: 10px;
  }
  
  .game-header {
      flex-direction: column;
  }
  
  .score-container {
      margin-bottom: 10px;
  }
  
  .control-group {
      flex-wrap: wrap;
  }
  
  button {
      flex: 1;
      min-width: 100px;
  }
}

/* 结算界面样式 */
.game-over-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.game-over-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: linear-gradient(135deg, #0a0a2e 0%, #0d182e 100%);
  border: 2px solid #00f7ff;
  box-shadow: 0 0 30px rgba(0, 247, 255, 0.5);
  border-radius: 10px;
  padding: 30px;
  width: 90%;
  max-width: 500px;
  text-align: center;
  position: relative;
  transform: translateY(-50px);
  transition: transform 0.5s;
  overflow: hidden;
}

.game-over-modal.active .modal-content {
  transform: translateY(0);
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #00ff88, #00f7ff);
  animation: rainbow 3s linear infinite;
}

@keyframes rainbow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.modal-title {
  color: #fff;
  font-size: 32px;
  margin: 0 0 20px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0, 247, 255, 0.7);
}

.normal-mode .modal-title {
  color: #00f7ff;
}

.obstacle-mode .modal-title {
  color: #d4b483;
}

.ai-mode .modal-title {
  color: #ff3366;
}

.score-container {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.score-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.2);
}

.score-label {
  color: rgba(255, 255, 255, 0.7);
}

.score-value {
  font-weight: bold;
  color: #fff;
}

.player-stats {
  border-left: 3px solid #00ff88;
  background: rgba(0, 255, 136, 0.1);
}

.ai-stats {
  border-left: 3px solid #ff3366;
  background: rgba(255, 51, 102, 0.1);
}

.high-score {
  border-left: 3px solid #ffff00;
  background: rgba(255, 255, 0, 0.1);
}

.game-time {
  border-left: 3px solid #00f7ff;
  background: rgba(0, 247, 255, 0.1);
}

.mode-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 15px;
  text-transform: uppercase;
}

.normal-mode .mode-badge {
  background: rgba(0, 247, 255, 0.2);
  color: #00f7ff;
  border: 1px solid #00f7ff;
}

.obstacle-mode .mode-badge {
  background: rgba(212, 180, 131, 0.2);
  color: #d4b483;
  border: 1px solid #d4b483;
}

.ai-mode .mode-badge {
  background: rgba(255, 51, 102, 0.2);
  color: #ff3366;
  border: 1px solid #ff3366;
}

.buttons-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.modal-button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 16px;
  min-width: 120px;
}

.restart-btn {
  background: linear-gradient(135deg, #00ff88 0%, #00f7ff 100%);
  color: #000;
}

.restart-btn:hover {
  background: linear-gradient(135deg, #00f7ff 0%, #00ff88 100%);
  box-shadow: 0 0 15px rgba(0, 247, 255, 0.5);
}

.menu-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.menu-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.share-btn {
  background: linear-gradient(135deg, #ff3366 0%, #ff9933 100%);
  color: #fff;
}

.share-btn:hover {
  background: linear-gradient(135deg, #ff9933 0%, #ff3366 100%);
  box-shadow: 0 0 15px rgba(255, 51, 102, 0.5);
}

.score-animation {
  animation: scoreGlow 1s ease-in-out;
}

@keyframes scoreGlow {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); color: #00ff88; text-shadow: 0 0 10px #00ff88; }
  100% { transform: scale(1); }
}

/* 粒子背景 */
.particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

.modal-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0;
  animation: floatParticle 5s infinite linear;
}

@keyframes floatParticle {
  0% { transform: translateY(100px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 0.8; }
  100% { transform: translateY(-100px); opacity: 0; }
} 